@extends('admin.layout.layout')

@section('content')

    <div class="layui-form"  style="padding: 20px 0 0 0;">

        {{csrf_field()}}

        <input type="hidden" name="id" value="{{$record->id}}">

        <div class="layui-form-item">
            <label class="layui-form-label">原密码</label>
            <div class="layui-input-inline">
                <input type="password" name="originPassword" lay-verify="required|pass" placeholder="请输入密码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">新密码</label>
            <div class="layui-input-inline">
                <input type="password" name="newPassword" lay-verify="required|pass" placeholder="请输入密码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">确认新密码</label>
            <div class="layui-input-inline">
                <input type="password" name="newPassword1" lay-verify="required|pass|confirm" placeholder="请输入密码" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item layui-hide">
            <input type="button" lay-submit lay-filter="LAY-submit" id="LAY-submit" value="确认">
        </div>
    </div>


@endsection

@section('js')
    <script>

        lay.use(['index','form'],function (){
            var $ = layui.$,form = layui.form;
            form.verify({
                pass: [
                    /^[\S]{6,12}$/
                    ,'密码必须6到12位，且不能出现空格'
                ],
                confirm:function (value, item){
                    var newPassword = $("input[name=newPassword]").val();
                    if(newPassword!==value){
                        return '两次密码输入不一致';
                    }
                }
            });
        });

    </script>

@endsection

